package com.spsoft.workflow.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.spsoft.core.model.Result;
import com.spsoft.core.model.bo.TokenUser;
import com.spsoft.workflow.common.enums.BusFlowTypeEnums;
import com.spsoft.workflow.entity.WfProcessBusiness;
import com.spsoft.workflow.model.dto.bus.*;
import com.spsoft.workflow.model.dto.json.ChildNode;
import com.spsoft.workflow.model.vo.biz.BusinessFlowVo;
import com.spsoft.workflow.model.vo.biz.TaskVO;
import org.flowable.task.api.Task;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;


/**
 * <p>
 * 流程业务表;--主键序列 SEQ_WF_PROCESS_BUSINESS 服务类
 * </p>
 *
 * @author dlchen
 * @since 2023-11-13
 */
@Validated
public interface ProcessBusinessService extends IService<WfProcessBusiness> {


    ChildNode getFlowNodeConfig(String taskId);

    void updateBizStatus(String processInstanceId, String bizStatus,String roleName);

    List<TaskVO> findReturnTaskList(String taskId);


    String getLastNodeCanBack(String taskId);


    Result getNextFlowNode(@Valid NextFlowDto nextFlowDto);

    Result<IPage<BusinessFlowVo>> queryProcessToDo(@Valid QueryProcessDto pqd);
    Result<BusinessFlowVo> queryProcessToDoBuyId(Long busId,String userCode,String deptCode);
    Result<IPage<BusinessFlowVo>> queryProcessHasDone(@Valid QueryProcessDto pqd);

    Result<IPage<BusinessFlowVo>> queryStartProcessMyself(@Valid QueryProcessDto pqd);



    Result findApprovalUser(@Valid FindApprovalUserDto f);

    public Result newfindApprovalUser(String busType,String deptCode);


    public ChildNode getNextNodeId(Long templateId,String nodeId,boolean isParent);

    void approved(WfProcessBusiness wfpb, String nextHandleUser , TokenUser user, Task task);

    WfProcessBusiness getProcessBusinessByBusId(Long busId);

    boolean isProcessNotEnd(@Valid @NotNull(message = "机构编码不能是空") String deptCode, @NotNull(message = "审批流id不能是空") Long busId, @NotNull(message = "流程类型不能是空")BusFlowTypeEnums busFlowTypeEnums);
}
